package com.hrp.controller;

import com.hrp.domain.*;
import com.hrp.service.JxkhzbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/8/9 0009.
 */
@RestController
@RequestMapping("jxkhzb")
public class JxkhzbController {

    @Autowired
    private JxkhzbService jxkhzbService;


    @RequestMapping("/getKhzbListByZblb")
    public List<Jxkhzb> getKhzbListByZblb(Integer zblb){
        return jxkhzbService.getKhzbListByZblb(zblb);
    }

    @RequestMapping("/getAllZblb")
    public List<Combox> getAllZblb(){
        return jxkhzbService.getAllZblb();
    }

    @RequestMapping("/getKhzbTreeListByZblb")
    public List<Tree> getKhzbTreeListByZblb(Integer zblb){
        return jxkhzbService.getKhzbTreeListByZblb(zblb);
    }

    @RequestMapping("/getZbListByZqidAndJxksdm")
    public List<Jxkhzb> getZbListByZqidAndJxksdm(String jxksdm,Integer zqid){
        return jxkhzbService.getZbListByZqidAndJxksdm(jxksdm,zqid);
    }

    @RequestMapping("/saveZbValueByJxksdmAndZqidAndZbid")
    public String saveZbValueByJxksdmAndZqidAndZbid(Double value,String jxksdm,String zbdm,Integer zqid){
        jxkhzbService.saveZbValueByJxksdmAndZqidAndZbid(value,jxksdm,zbdm,zqid);
        return "成功";
    }

    @RequestMapping("/getMaxZbid")
    public String getMaxZbid(){
        return jxkhzbService.getMaxZbid();
    }

    @RequestMapping("/saveKhzbData")
    public ResponseData saveKhzbData(Jxkhzb jxkhzb){
        try{
            jxkhzbService.saveKhzbData(jxkhzb);
            return ResponseData.ok();
        }catch (Exception e){
            return ResponseData.build(500,"数据保存失败");
        }
    }



}
